package com.v2future.sjt.collegecheckingattendance.widget.view;

import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.LayoutAnimationController;
import android.view.animation.RotateAnimation;
import android.view.animation.TranslateAnimation;

/**
 * 动画
 *
 * @author shijianting
 *         2015年8月17日
 *         下午2:37:58
 */
public class ListViewAnimation {

    /**
     * 渐变透明
     *
     * @return
     */
    public static LayoutAnimationController getAlphaAnimation() {
        AnimationSet set = new AnimationSet(false);
        Animation animation = new AlphaAnimation(0, 1);   //AlphaAnimation 控制渐变透明的动画效果
        animation.setDuration(200);     //动画时间毫秒数
        set.addAnimation(animation);    //加入动画集合
        LayoutAnimationController controller = new LayoutAnimationController(set, 1);
        return controller;
    }

    /**
     * 尺寸伸缩
     *
     * @return
     */
    public static LayoutAnimationController getTranslateAnimation() {
        AnimationSet set = new AnimationSet(false);
        Animation animation = new TranslateAnimation(1, 13, 10, 50);  //ScaleAnimation 控制尺寸伸缩的动画效果
        animation.setDuration(300);
        set.addAnimation(animation);
        LayoutAnimationController controller = new LayoutAnimationController(set, 1);
        return controller;
    }

    /**
     * 画面平移
     *
     * @return
     */
    public static LayoutAnimationController getRotateAnimation() {
        AnimationSet set = new AnimationSet(false);
        Animation animation = new RotateAnimation(30, 10);    //TranslateAnimation  控制画面平移的动画效果
        animation.setDuration(300);
        set.addAnimation(animation);
        LayoutAnimationController controller = new LayoutAnimationController(set, 1);
        return controller;
    }

}
